<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	//获取pasc记录
	String cardNumber = input.getDesc("cardNumber","320222193703042061");//身份证号
	String patientName = input.getDesc("patientName","薛银娣");
	List<Map> list = QBuilder.db("basedb").queryHql("select new map(cardno as cardno) from ZY_BRXXK where sfzh = '"+cardNumber+"' and hzxm = '"+ patientName +"' ");
	if(list == null || list.size() == 0){//没有去门诊查
		list = QBuilder.db("basedb").queryHql("select new map(cardno as cardno) from SF_BRXXK where sfzh = '"+cardNumber+"' and hzxm = '"+ patientName +"' ");
	}
	
	
	String cardNo = "-20";
	StringBuffer sb = new StringBuffer();
	sb.append("'-20'");
	if(list !=null && list.size() != 0 ){
		 for(Map map : list){
			 sb.append(",");
			 sb.append("'");
			 sb.append(map.get("cardno").toString());
			 sb.append("'");
		 }
		 
	}
		
	String content = "regNo as regNo ,reportNo as reportNo , reportName as reportName ,applyDate as applyDate, executDate as executDate , reportDate as reportDate, operPartCode as operPartCode , operPartName as operPartName, examCategCode as examCategCode ,examCategName as examCategName , examMethodCode as examMethodCode , examMethodName as examMethodName , examItemCode as examItemCode , examItemName as examItemName, examResult as examResult , examDes as examDes";
	List<Map> lis = QBuilder.db("pacdb").queryHql("select new map (" + content + " ) from pacsInfo where regNo in(" + sb.toString() + ")");
	if(lis != null && lis.size() > 0)
	 for(Map map : lis){
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		String applyDate = map.get("applyDate") == null ? "" : sdf1.format(sdf.parse(map.get("applyDate").toString())) ;
		String executDate = map.get("executDate") == null ? "" : sdf1.format(sdf.parse(map.get("executDate").toString())) ;
		String reportDate = map.get("reportDate") == null ? "" : sdf1.format(sdf.parse(map.get("reportDate").toString())) ;
		
		map.put("applyDate",applyDate);
		map.put("executDate",executDate);
		map.put("reportDate",reportDate);
	}
	Message msg = new Message();
	msg.put("errcode",0);
	msg.put("data",lis);
	out.println(msg);
%>